package com.cesce.batch.cobros.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class ResourceFtpRegistroBeanPostProcessor implements BeanPostProcessor, ApplicationContextAware {

    private ApplicationContext applicationContext;
    public void setApplicationContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
    }

    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }

    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
//        if((bean instanceof MyClient)) && (beanName.equals("MyClient"))) {
//            Myregistry registryService = (Myregistry) applicationContext.getBean("registryService");
//
//           ((MyClient) bean).setEndPoint(registryService.getEndPoint("bar"));
//        }

        return bean;
    }
}